package com.artwork.service.impl;

import com.artwork.mapper.ArticleMapper;
import com.artwork.model.Article;
import com.artwork.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author JoJo
 * @Data 2021/9/8$ 14:52$
 * @Description
 * @Param $
 * @Return $
 */
@Service
public class ArticleServiceImpl implements ArticleService {
    @Autowired
    ArticleMapper articleMapper;

    @Override
    public List<Article> getList() {
        return articleMapper.getList();
    }

    @Override
    public int addArticle(Article article) {
        return articleMapper.insertSelective(article);
    }

    @Override
    public Article getArticleById(Integer id) {
        return articleMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateArticle(Article article) {
        return articleMapper.updateByPrimaryKeySelective(article);
    }

    @Override
    public int pushArticle(int id, int status) {
        return articleMapper.pushArticle(id, status);
    }

    @Override
    public int deleteArticle(int id) {
        return articleMapper.deleteArticle(id);
    }
}
